# if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells:
!pip install git+https://github.com/NREL/PV_ICE.git@development
import os
import PV_ICE
PV_ICE.__version__
testfolder = 'Sunday'
if not os.path.exists(testfolder):
os.makedirs(testfolder)
r1 = PV_ICE.Simulation(name='Sim1', path=testfolder, baselinepath='/content')
r1
PV ICE uses object oriented programing, so this created a PV_ICE.main.Simulation Object. An Object is data field that has unique attributes and behaviors. We can crack open objects with the .__dict__ command
r1.__dict__
Drag the files to the /content folder
Alternatively, the cell below can open a upload window
#from google.colab import files
#files.upload()
First create scenario and add its module files
r1.createScenario(name='standard',
massmodulefile=r'baseline_modules_mass_US.csv',
energymodulefile = 'baseline_modules_energy.csv' )
Then add at least one material file
r1.scenario['standard'].addMaterial(materialname='glass',
massmatfile='/content/baseline_material_mass_glass.csv',
energymatfile='/content/baseline_material_energy_glass.csv')
We can explore the module and material objects now. For example:
r1.scenario['standard'].material['glass']
r1.scenario['standard'].material['glass'].__dict__
r1.scenario['standard'].material['glass'].matdataIn_m
r1.calculateMassFlow()
r1.calculateEnergyFlow()
Same thing, but together
r1.calculateFlows()
We can explore the outputs. They are still a bit raw at this step
r1.scenario['standard'].dataOut_m.keys()
USyearly, UScum = r1.aggregateResults()
# The results are also saved into the simulation object itself:
# r1.USyearly
# r1.UScum
USyearly.keys()
UScum.keys()
This is useful to see the inputs (in case you modified the values with some of the support functions), the full dataframes of internal processing data, and the outputs in an organized manner
r1.saveSimulation()
From this list, select the one that fits your study and select the type of plotting method. There are various plotting options:
plotScenariosComparisonplotMaterialComparisonAcrossScenariosplotMetricResults: You can select the following keyword options: 'VirginStock', 'WasteALL', 'WasteEOL', 'WasteMFG'plotMaterialResultsplotInstalledCapacityResultsYou can also view all the keywords you can use by calling the function without argumnets, or by printing the keys to the module data or the material data
r1.plotMetricResults()
r1.plotScenariosComparison()
r1.plotMaterialComparisonAcrossScenarios(material='silicon', keyword='mat_virgin_eff')
r1.plotMaterialResults(keyword='VirginStock')
r1.plotInstalledCapacityResults()